Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment to try and make it clearer where the "contract" is defined #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tobyweston
Copy link
Member

I see the test as having two elements 1) the stubbed behaviour that mimics the server (the "contract") and 2) assertions against that.

Experiment to try and formalise that by splitting the former into a Contract type. This is really a place to collect factory style methods to setup the stubs. So you might have different methods there to document what you'd expect from different endpoints in different scenarios.

In most of my apps when local / unit testings, we tent to have a bunch a stub creation methods, some parameterised to be configurable.

Something to reflect on (not expecting anyone to merge the PR) and discuss.

.body(expectedAccountsBody())
.toPact();
}
@Pact(provider = "account_provider", consumer = "mobile_consumer")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Pact annotations are BS. Is there a way to do this programmatically within the test.

Annotations = bad news (generally) 🔥

@tobyweston tobyweston closed this Jun 8, 2021
@tobyweston tobyweston reopened this Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants